package com.twu.biblioteca.service;

import com.twu.biblioteca.model.BorrowableAsset;
import com.twu.biblioteca.model.Library;
import com.twu.biblioteca.model.LibraryService;
import com.twu.biblioteca.model.ServiceResult;

/**
 * Created by davecroman on 20/09/2014.
 */
public class PersonalProfileService extends LibraryService{

    public PersonalProfileService(Library library){
        super(library);
    }

    @Override
    public ServiceResult performService() {
        StringBuilder result = new StringBuilder();

        result.append(user.toString());
        result.append("Borrowed items: \n");
        for(BorrowableAsset item: user.getBorrowedItems()){
            result.append(item.toString() + "\n");
        }

        return new ServiceResult(result.toString());
    }

    @Override
    public String getName() {
        return "My Profile";
    }
}
